package shaders;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;

public final class ShaderLoader {

	static final public ShaderProgram createShader(String vertexName,
			String fragmentName) {
		final String vertexShader = Gdx.files.classpath("shaders/" + vertexName
				+ ".vertex.glsl").readString();
		final String fragmentShader = Gdx.files.classpath("shaders/" + fragmentName
				+ ".fragment.glsl").readString();
		
		ShaderProgram.pedantic = false;		
		ShaderProgram shader = new ShaderProgram(vertexShader, fragmentShader);
		if (!shader.isCompiled()) {
			System.out.println("error" + shader.getLog());
			Gdx.app.exit();
		}
		return shader;
	}
}
